﻿using System;
using System.Data.Common;
using System.Numerics;

namespace Prime_Factor
{
    class Factor
    {
        static int MaxNum(List<int> num)
        {
            if (num == null)
            {
                return 0;
            }
            int max = num[0];
            for (int i = 0; i < num.Count; i++)
            {
                if ((num[i] > max)) { max = num[i]; }
            }
            return max;
        }
        static int MinNum(List<int> num)
        {
            if (num == null)
            {
                return 0;
            }
            int min = num[0];
            for (int i = 0; i < num.Count; i++)
            {
                if ((num[i] < min)) { min = num[i]; }
            }
            return min;
        }
        static int Sum(List<int> num)
        {
            int sum = 0;
            for (int i = 0; num.Count > i; i++)
            {
                sum += num[i];
            }
            return sum;
        }
        static int Average(List<int> num)
        {
            int sum = Sum(num);
            return sum / num.Count;
        }
        static void Main()
        {
            Console.WriteLine("请输入一行数字，用空格分割");
            string str=Console.ReadLine();
            string[] input = str.Split(" ");
            List<int> list = new List<int>();
            for(int i = 0; i < input.Length; i++)
            {
                list.Add(int.Parse(input[i]));
            }
            Console.WriteLine($"最大值是{MaxNum(list)}，" +
                $"最小值是{MinNum(list)}，平均值是{Average(list)}" +
                $"，和是{Sum(list)}");
        }
    }
}

